package com.feng.ssm.service;

import com.feng.ssm.dao.BookMapper;
import com.feng.ssm.pojo.Book;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    private BookMapper bookMapper;

    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    /*public BookServiceImpl(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }*/

    public int addBook(Book book) {
        int i = bookMapper.addBook(book);
        return i;
    }

    public int deleteBook(int id) {
        int i = bookMapper.deleteBook(id);
        return i;
    }

    public int updateBook(Book book) {
        return bookMapper.updateBook(book);
    }

    public Book queryBookById(int id) {
        return bookMapper.queryBookById(id);
    }

    public List<Book> queryAllBook() {
        return bookMapper.queryAllBook();
    }
}
